using DocumentCreationSystem.Models;

namespace DocumentCreationSystem.Services
{
    /// <summary>
    /// 记忆系统接口（支持内置与 ai00-mem 适配器）
    /// </summary>
    public interface IMemoryService
    {
        /// <summary>
        /// 初始化
        /// </summary>
        Task<bool> InitializeAsync(MemoryConfig config);

        /// <summary>
        /// 写入一条记忆
        /// </summary>
        Task<string> AddMemoryAsync(string content, string? userId = null, string? sessionId = null, Dictionary<string, object>? attributes = null);

        /// <summary>
        /// 查询相关记忆
        /// </summary>
        Task<List<MemoryResult>> QueryAsync(string query, string? userId = null, int topK = 5, float threshold = 0.7f);
    }

    /// <summary>
    /// 查询结果
    /// </summary>
    public class MemoryResult
    {
        public string Id { get; set; } = string.Empty;
        public float Score { get; set; }
        public string Content { get; set; } = string.Empty;
        public Dictionary<string, object> Attributes { get; set; } = new();
    }
}

